package com;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class HelloController {

    @RequestMapping("/hello")
    public String hello() {
        System.out.println("处理地址为/hello的请求---");
        //abc是一个逻辑视图的名字，靠视图解析器解析成物理的jsp文件
        return "abc";
    }

    @RequestMapping("/world")
    public ModelAndView world() {
        System.out.println("world---");
        ModelAndView mav = new ModelAndView();
        mav.setViewName("world");
        // req.setAttribute("msg","helloWorld");
        mav.addObject("msg", "hello world!");
        return mav;
    }
}
